package main

import (
	"fmt"
	"flag"
)

func main()  {
	var user string
	var pwd string
	var port int
	var host string

	flag.StringVar(&user,"u","","用户名，默认为空")
	flag.StringVar(&pwd,"pwd","","密码，默认为空")
	flag.StringVar(&host,"h","localhost","目标地址")
	flag.IntVar(&port,"p",1234,"端口号，默认为空")

	flag.Parse()//此方法必须调用，否则执行失败

	fmt.Printf("user=%v,pwd=%v,port=%v,host=%v",
		user,pwd,port,host)
}